package com.getinstaliker.activity;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.Window;

import com.instagram.getinstaliker.R;

/**
 * The Class BaseFragmentActivity.
 * @author HuanND
 */
public abstract class BaseFragmentActivity extends FragmentActivity{

	/* (non-Javadoc)
	 * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle)
	 */
	@Override
	protected void onCreate(Bundle arg0) {
		super.onCreate(arg0);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.content_frame);
	}
	
	/**
	 * Switch content.
	 *
	 * @param frag the frag
	 * @param isAddToBackStack the is add to back stack
	 */
	public void switchContent(Fragment frag,boolean isAddToBackStack){
        FragmentTransaction fragManager = getSupportFragmentManager().beginTransaction();
        fragManager.replace(R.id.content_frame, frag);
        if(isAddToBackStack){
            fragManager.addToBackStack(null);
        }
        fragManager.commit();
    }
}
